package com.yuxi.Dao.Impl;

import java.io.Serializable;
import java.util.List;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.yuxi.Dao.EvaluationRecordBrowseDao;
import com.yuxi.Entity.CommentRecordBrowse;
import com.yuxi.Entity.EvaluationRecordBrowse;
import com.yuxi.Entity.UserInfo;
@Repository
public class EvaluationRecordBrowseDaoImpl extends BaseDaoImpl<Serializable, Serializable> implements EvaluationRecordBrowseDao {
	private Logger logger=LoggerFactory.getLogger(EvaluationRecordBrowseDaoImpl.class);
	public EvaluationRecordBrowseDaoImpl(){
		super(EvaluationRecordBrowse.class);
	}
	@Override
	public EvaluationRecordBrowse getRBrowse(Integer eRBrowseId) {
		// TODO Auto-generated method stub
		return (EvaluationRecordBrowse) super.get(eRBrowseId);
	}

	@Override
	public EvaluationRecordBrowse addRBrowse(EvaluationRecordBrowse eRBrowse) {
		// TODO Auto-generated method stub
		return (EvaluationRecordBrowse) super.addAndReturn(eRBrowse);
	}

	@Override
	public void deleteRBrowse(EvaluationRecordBrowse eRBrowse) {
		// TODO Auto-generated method stub
		super.delete(eRBrowse);
	}

	@Override
	public void modifly(EvaluationRecordBrowse eRBrowse) {
		// TODO Auto-generated method stub
		super.update(eRBrowse);
	}
	@Override
	public List<EvaluationRecordBrowse> getEvaluationRecordBrowseByInfoId(int infoId,int eRecordId) {
		return super.find("from EvaluationRecordBrowse where informationId = ? and isLook = ? and evaluationRecordId =?  order by createTime desc", infoId,true,eRecordId);
	}
	@Override
	public EvaluationRecordBrowse getRecordBrowseByInfoIdAndUserId(int infoId, int userId) {
		// TODO Auto-generated method stub
		return  (EvaluationRecordBrowse)super.find("from EvaluationRecordBrowse where informationId = ? and userId = ?  order by createTime desc", infoId,userId).get(0);

	}
	@Override
	public void bulkUpdate(Integer infoId, Integer userId) {
		// TODO Auto-generated method stub
		super.delete("update from EvaluationRecordBrowse set createTime=?,isLook=? where informationId=? and userId =?",System.currentTimeMillis(),true,infoId,userId);
	}

}
